Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 5 - Menu Manager Reference / Menu Manager Resources


The Menu Resource

CHANGED WITH THE APPEARANCE MANAGER

You can provide descriptions of your menus in 'MENU' resources and use the function GetMenu or GetNewMBar to read the descriptions of your menus. After reading in the resource description, the Menu Manager stores the information about specific menus in menu structures. When you use a menu resource to define a menu, you should check for the presence of an extended menu resource with the same resource ID.

WARNING
Menus in a resource must not be purgeable nor should they have the resource lock bit set. They must have resource ID numbers greater than 127. Do not define a "circular" hierarchical menu--that is, a hierarchical menu in which a submenu has a submenu whose submenu is a hierarchical menu higher in the chain.
Figure 5-1 shows the format of a compiled 'MENU' resource.


Figure 5-1 Structure of a compiled menu ('MENU') resource

A compiled version of a 'MENU' resource contains the following elements:

Figure 5-2 shows the variable-length data portion of a compiled 'MENU' resource that uses the standard menu definition function.


Figure 5-2 The variable-length data that describes menu items as defined by the standard menu definition function

The variable-length data portion of a compiled version of a 'MENU' resource that uses the standard menu definition function contains the following elements:

If you provide your own menu definition function, you should use the same format for your resource descriptions of menus as shown in Figure 5-1. You can use the same format or one of your choosing to describe menu items. You can also use bits 1-31 of the enableFlags field of the menu structure as you choose; however, bit 0 must still indicate whether the menu is enabled or disabled.

WHEN THE APPEARANCE MANAGER IS NOT AVAILABLE
The menu resource, while identical in format, may take on different values in its variable-length data portion, depending on the type of information you want to display with your menu item.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998